<!-- $Id: _form.php,v 1.1 2011-06-17 04:43:20 herve Exp $ -->
<div class="yiiForm">

<?php $this->widget('application.components.RequiredMessage'); ?>

<?php
echo CHtml::beginForm();
?>

<?php echo CHtml::errorSummary($model); ?>

<?php
if (!$update) {
	?>
	<div class="simple">
		<?php echo CHtml::activeLabelEx($model,'username'); ?>
		<?php echo CHtml::activeTextField($model,'username',array('size'=>20,'maxlength'=>20)); ?>
	</div>
	<div class="simple">
		<?php echo CHtml::activeLabelEx($model,'password'); ?>
		<?php echo CHtml::activePasswordField($model,'password',array('size'=>50,'maxlength'=>50,'text'=>'')); ?>
	</div>
	<div class="simple">
		<?php echo CHtml::activeLabelEx($model,'password_check'); ?>
		<?php echo CHtml::activePasswordField($model,'password_check',array('size'=>50,'maxlength'=>50,'text'=>'')); ?>
	</div>
	<?php

} else {
	?>
	<div class="simple">
		<?php echo CHtml::activeLabelEx($model,'username'); ?>
		<?php echo CHtml::activeTextField($model,'username',array('size'=>20,'maxlength'=>20,'readonly'=>'readonly')); ?>
	</div>
	<?php
}
?>

<div class="simple">
	<?php echo CHtml::activeLabelEx($model,'language'); ?>
	<?php echo CHtml::activeDropDownList($model,'language',Constants::userLanguages(), array()); ?>
</div>

<div class="simple">
	<?php echo CHtml::activeLabelEx($model,'email'); ?>
	<?php echo CHtml::activeTextField($model,'email',array('size'=>60,'maxlength'=>255)); ?>
</div>

<div class="simple">
	<?php echo CHtml::activeLabelEx($model,'initials'); ?>
	<?php echo CHtml::activeTextField($model,'initials',array('size'=>5,'maxlength'=>3,'onkeyup'=>'this.value = this.value.toUpperCase();', 'style' => 'text-transform: uppercase')); ?>
</div>

<div class="simple">
	<?php echo CHtml::activeLabelEx($model,'first_name'); ?>
	<?php echo CHtml::activeTextField($model,'first_name',array('size'=>60,'maxlength'=>100)); ?>
</div>

<div class="simple">
	<?php echo CHtml::activeLabelEx($model,'last_name'); ?>
	<?php echo CHtml::activeTextField($model,'last_name',array('size'=>60,'maxlength'=>100)); ?>
</div>

<div class="simple">
	<?php echo CHtml::activeLabelEx($model,'phone_number'); ?>
	<?php echo CHtml::activeTextField($model,'phone_number',array('size'=>50,'maxlength'=>50)); ?>
</div>

<div class="simple">
	<?php echo CHtml::activeLabelEx($model,'simulation'); ?>
	<?php echo CHtml::activeCheckBox($model,'simulation'); ?>
</div>

<div class="simple">
	<?php echo CHtml::activeLabelEx($model,'roles'); ?>
	<?php 
	$roles = Yii::app()->authManager->getRoles();
	$data = array();
	foreach ($roles as $role)
	{
		$data[$role->name] = $role->description;
	}
	echo CHtml::activeListBox($model, 'roles', $data, array('multiple' => 'multiple')); 
	
	?>
</div>

<div class="action">
<?php echo CHtml::submitButton($update ? Yii::t('views','Save') : Yii::t('views','Create')); ?>
</div>

<?php echo CHtml::endForm(); ?>

</div><!-- yiiForm -->
